package com.chuangjiangx.member.coupon.ddd.domain.model;

import lombok.Getter;

/**
 * Created by zhoufushou on 2017/12/16.
 * 领取门槛类型
 */
@Getter
public enum ReceiveThresholdType {
    FREE("免费领取", (byte)1),
    SCORE("积分兑换", (byte)2),
    PRICE("指定售价", (byte)3);

    public final String name;
    public final Byte code;

    ReceiveThresholdType(String name, Byte code) {
        this.name = name;
        this.code = code;
    }

    public static ReceiveThresholdType get(Byte code){
        for(ReceiveThresholdType back : values()){
            if(back.code.equals(code)){
                return back;
            }
        }
        return null;
    }
}
